﻿#!/bin/sh
################################################
##Author:yjt
##date:2018-07-13
##func:load data from hdfs to hbase  by use Phoenix
################################################
. ${0%`basename ${0}`}edw_parm.sh
. ${0%`basename ${0}`}edw_func.sh

#delete data before insert 
cd /home/hadoop/dwhdp/core/phoenix/bin && ${V_RUN_PHOENIX_SQL} -q "${V_SHELL_PROC}/Phoenix.DEL_DATA.sql"

if [[ $? -eq 0 ]]; then
#loaf data to phoenix from hdfs
#cd /home/hadoop/dwhdp/core/phoenix && hadoop jar phoenix-4.13.1-HBase-1.1-client.jar org.apache.phoenix.mapreduce.CsvBulkLoadTool -t depb_info -d ',' -i /user/phonenix/depb_info.csv -z hadoop01,hadoop02,hadoop03:2181
#cd /home/hadoop/dwhdp/core/phoenix && hadoop jar phoenix-4.13.1-HBase-1.1-client.jar org.apache.phoenix.mapreduce.CsvBulkLoadTool -t loab_info -d ',' -i /user/phonenix/loab_info.csv -z hadoop01,hadoop02,hadoop03:2181
#cd /home/hadoop/dwhdp/core/phoenix && hadoop jar phoenix-4.13.1-HBase-1.1-client.jar org.apache.phoenix.mapreduce.CsvBulkLoadTool -t loaf_info -d ',' -i /user/phonenix/loaf_info.csv -z hadoop01,hadoop02,hadoop03:2181
#cd /home/hadoop/dwhdp/core/phoenix && hadoop jar phoenix-4.13.1-HBase-1.1-client.jar org.apache.phoenix.mapreduce.CsvBulkLoadTool -t ibab_info -d ',' -i /user/phonenix/ibab_info.csv -z hadoop01,hadoop02,hadoop03:2181


for tab_name in "eoab_info" ; do 
# "depb_info" "loab_info" "loaf_info" "moab_info" "eoab_info" "eoaf_info" "toab_info" "toaf_info"
    echo ${tab_name}
    cd /home/hadoop/dwhdp/core/phoenix && hadoop jar phoenix-4.13.1-HBase-1.1-client.jar org.apache.phoenix.mapreduce.CsvBulkLoadTool -t ${tab_name} -d ',' -i /user/phonenix/${tab_name}.csv -z hadoop01,hadoop02,hadoop03:2181
done


fi

if [[ $? -ne 0 ]]; then
    exit 1
 else
    exit 0 
fi 

